package edu.xkd;

import edu.xkd.slice.MainAbilitySlice;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.components.Text;

public class MainAbility extends Ability {
    Text text=null;
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setMainRoute(MainAbilitySlice.class.getName());
        text=(Text)this.findComponentById(ResourceTable.Id_text_Info);
        Button button_login=(Button)this.findComponentById(ResourceTable.Id_button_login);
        Button button_register=(Button)this.findComponentById(ResourceTable.Id_button_register);
        button_login.setClickedListener(this::clickedListenerButton01);
        button_register.setClickedListener(this::clickedListenerButton02);

    }

    private void clickedListenerButton01(Component component) {
        text.setText("登录按钮单击！");
    }

    private void clickedListenerButton02(Component component) {
        text.setText("注册按钮单击！");
    }
}
